const { DataTypes, Model, Deferrable } = require("sequelize");
const sequelize = require("../../db/sequelize");
/**
 * 规格卡片值
 */
class GoodsSkusCardValue extends Model {
    static async addGoodsSkusCardValue(goods_skus_card_id, name, order, value) {
        return await this.create({
            goods_skus_card_id: goods_skus_card_id,
            name: name,
            value: value,
            order: order
        })
    }
    static async updateGoodsSkusCardValue(goods_skus_card_id, name, order, value, id) {
        return await this.update({
            goods_skus_card_id: goods_skus_card_id,
            name: name,
            value: value,
            order: order
        }, {
            where: {
                id: id
            }
        })
    }
    static async deleteGoodsSkusCardValue(id){
        return await this.destroy({
            where:{
                id:id
            }
        })
    }
};
GoodsSkusCardValue.init({
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    goods_skus_card_id: {
        type: DataTypes.INTEGER
    },
    name: {
        type: DataTypes.STRING
    },
    value: {
        type: DataTypes.STRING
    },
    order: {
        type: DataTypes.INTEGER
    }
}, {
    sequelize,
    timestamps: false,
    modelName: "GoodsSkusCardValue",
    tableName: "goods_skus_card_value",
})
module.exports = GoodsSkusCardValue